{*
SPDX-FileCopyrightText: © 2023 Olivier Meunier <olivier@neokraft.net>

SPDX-License-Identifier: AGPL-3.0-only
*}
{{- import "/_libs/common" -}}

<turbo-frame id="bookmark-share-{{ .ID }}">
  <p>You can share the following link with your friends.</p>
  <p class="mb-2">It expires on {{ date(.Expires, "Mon, 2 Jan. 2006 15:04 MST") }}</p>
  <p class="mb-2">
    <a class="link break-all" href="{{ .URL }}">{{ .URL }}</a>
  </p>
  <p class="mb-2">
    <img src="{{ qrcode(.URL, -3, `#1e485b`) }}" alt="" class="rounded">
  </p>

  <p class="flex max-sm:flex-col gap-2 mb-4" data-controller="clipboard">
    <input class="hidden" type="text" value="{{ .URL }}" data-clipboard-target="content">
    <button class="btn rounded" type="button" data-action="clipboard#copy">Copy link to clipboard</button>
    {{- if !isTurbo -}}
      <a class="sm:ml-auto btn btn-primary text-center" href="{{ urlFor(`..`, .ID) }}"
        data-controller="history" data-action="history#back">Go back to the bookmark</a>
    {{- end -}}
  </p>
</turbo-frame>
